package com.peng.service.impl;

import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peng.config.listener.UploadDataListener;
import com.peng.model.TClue;
import com.peng.service.TClueService;
import com.peng.mapper.TClueMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.io.InputStream;

/**
* @author Love-ovo
* @description 针对表【t_clue(线索表)】的数据库操作Service实现
* @createDate 2025-03-14 21:28:14
*/
@Service
public class TClueServiceImpl extends ServiceImpl<TClueMapper, TClue>
    implements TClueService{

    @Resource
    private TClueMapper tClueMapper;

    @Override
    public void importExcel(InputStream inputStream, String token) {
        //链式编程，3个参数, 第一个参数是要读取的Excel文件，第二个参数是Excel模板类，第三个参数是文件读取的监听器
        EasyExcel.read(inputStream, TClue.class, new UploadDataListener(tClueMapper, token))
                .sheet()
                .doRead();
    }

    @Override
    public TClue getClueById(Integer id) {
        return tClueMapper.getClueById(id);
    }
}




